@extends('admin.layout.index')
@section('content')
<div class="col-md-12">
                    <!-- Advanced Tables -->
                    <div class="card">
                        <div class="card-action">
                             <a class="waves-effect waves-light btn-large " href="/admin/goods/add">商品添加</a>
                        </div>
                        <div class="card-content">
                            <div class="table-responsive">
                                <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline" role="grid">
                                	<div class="row">
                                		<form action=@if(!empty($request['class']) && !empty($request['id']))"/admin/classified/showgoods"@else "/admin/goods/index" @endif method="get">
                                                
                                                @if(!empty($request['class']) && !empty($request['id']))
                                                <input type="hidden" name="class" value="{{$request['class']}} ">
                                                <input type="hidden" name="id" value="{{$request['id']}}">
                                                @endif



                                		<div class="col-sm-3">
                                			<div class="dataTables_length" id="dataTables-example_length"><label>
                                				<select name="dataTables-example_length" aria-controls="dataTables-example" class="form-control input-sm">
                                					<option value="10" @if(!empty($request['dataTables-example_length']) && $request['dataTables-example_length'] == 10 ) selected @endif>10</option>
                                					
                                					<option value="20" @if(!empty($request['dataTables-example_length']) && $request['dataTables-example_length'] == 20 ) selected @endif>20</option>
                                					
                                					<option value="30" @if(!empty($request['dataTables-example_length']) && $request['dataTables-example_length'] == 30 ) selected @endif>30</option>
                                					
                                				</select> records per page</label>
                                                
                                			</div>
</div>
<div class="col-sm-3">
   
</div>




                                		
                                		<div class="col-sm-6">
                                			<div id="dataTables-example_filter" class="dataTables_filter">
                                				<label>关键字:
                                					<input type="search" name="search" class="form-control input-sm" value="{{ $request['search'] or '' }}" aria-controls="dataTables-example">
                                				</label>
                                				<button type="submit" class="btn btn-default"> 搜索 </button>
                                				
                                			</div>
                                       
                                		</form>
                                    @if(empty($request['class']) && empty($request['id']))
                                			<a href="/admin/goods/index?n=id" @if(empty($request['n'])) style="text-decoration:underline" @endif  @if(!empty($request['n']) && $request['n'] == 'id') style="text-decoration:underline" @endif> 默认排序 </a>
                                			|
                                			<a href="/admin/goods/index?n=price" @if(!empty($request['n']) && $request['n'] == 'price') style="text-decoration:underline" @endif> 价格排序 </a>
                                			|
                                			<a href="/admin/goods/index?n=sales" @if(!empty($request['n']) && $request['n'] == 'sales') style="text-decoration:underline" @endif> 销量排序 </a>
                                            |
                                            <a href="/admin/goods/index?n=evaulate" @if(!empty($request['n']) && $request['n'] == 'evaulate') style="text-decoration:underline" @endif> 评分排序 </a>
                                        
                                			|
                                			<a href="/admin/goods/index?n=inventory" @if(!empty($request['n']) && $request['n'] == 'inventory') style="text-decoration:underline" @endif> 库存排序 </a>
                                			|
                                			<a href="/admin/goods/index?n=ctime" @if(!empty($request['n']) && $request['n'] == 'ctime') style="text-decoration:underline" @endif> 时间排序 </a>
                                	@endif
                                        </div>
                                		</div>
                                	</div>
                                	<table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" aria-describedby="dataTables-example_info">
                                    <thead>
                                        <tr role="row">
                                        	<th class="sorting_asc" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column ascending" style="width: 258px;">商品名称
                                        	</th>
                                        	<th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" style="width: 150px;">商品头像
                                        </th>
                                        	<th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" style="width: 150px;">商品价格
                                        </th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" style="width: 136px;">评分
                                        </th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 136px;">
                                        	销量
                                        </th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 141px;">
                                        	库存
                                        </th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending" style="width: 300px;">上架时间
                                        </th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 300px;">销售者
                                        </th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending" style="width: 350px;">操作
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody>
             						@foreach($data as $v)
                                    <tr class="gradeA odd" @if($v['status'] == 1) style="background:#F2DEDE" @endif>
                                            <td class="sorting_1">{{ $v['goodsname'] }}</td>
                                            <td class="center"><img src="{{ $v['picture'] }}" onerror="this.src='/goodsupload/goodsphoto/default.gif'" style="width:20px;height:20px" /></td>
                                            <td class=" ">￥{{ $v['price'] }}</td>
                                            <td class=" ">{{ $v['evaulate'] }}</td>
                                            <td class=" ">{{ $v['sales'] }}</td>
                                            <td class=" ">{{ $v['inventory'] }}</td>
                                            <td class=" ">{{ date('Y-m-d h:i:s',$v['ctime']) }}</td>
                                            <td class="center ">{{ $v['username'] }}</td>
                                            <td class="center ">
                                            	<a href="javascript:;"  card="{{ $v['id'] }}" onclick="mydel(this)" >删除</a>
                                            	|
                                            	<a href="javascript:;" info="status" status="{{ $v['status'] }}" card="{{ $v['id'] }}" onclick="fun(this)">@if($v['status'] == 0)禁售@else开售@endif</a>
                                            	|
                                            	<a href="/admin/goods/details?gid={{ $v['id'] }}">详情</a>
                                            </td>
                                        </tr>
									@endforeach
                                    </tbody>
                                </table><div class="row"><div class="col-sm-6"><div class="dataTables_info" id="dataTables-example_info" role="alert" aria-live="polite" aria-relevant="all">Showing 1 to 10 of 57 entries</div></div><div class="col-sm-6"><div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
                                	{!! $data -> appends($request) -> render() !!}
                                </div></div></div></div>
                            </div>
                            
                        </div>
                    </div>
                    <!--End Advanced Tables -->
                </div>
@endsection
@section('classified')
<script src="/adminassets/goodsindexjs/goodsindex.js"></script>
@endsection